package com.hnust.aopdemo.chain;

import sun.applet.Main;

import java.util.Arrays;
import java.util.List;

public class ChainClient {
    static class ChainHandlerA extends ChainHandler {

        @Override
        protected void handleProcess() {
            System.out.println("handleProcess: handler by chainhandler A");
        }
    }

    static class ChainHandlerB extends ChainHandler {

        @Override
        protected void handleProcess() {
            System.out.println("handleProcess: handler by chainhandler B");
        }
    }

    static class ChainHandlerC extends ChainHandler {

        @Override
        protected void handleProcess() {
            System.out.println("handleProcess: handler by chainhandler C");
        }
    }

    public static void main(String[] args) {
        List<ChainHandler> handlerList = Arrays.asList(new ChainHandlerA(), new ChainHandlerB(), new ChainHandlerC());
        Chain chain = new Chain(handlerList);
        chain.proceed();
    }
}
